package com.platform.server.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.platform.server.service.AccountService;

@Controller
@RequestMapping("/account")
public class AccountController {

    @Autowired
    private AccountService accountService;

    /**
     * 绑定银行卡卡号 --
     */
    @ResponseBody
    @RequestMapping(value = "/bindingBank", method = RequestMethod.POST)
    public Object bindingBank(String username, String bankName, String bankNum, String id) {
        return accountService.bindingBank(username, bankName, bankNum, id);
    }

    /**
     * 绑定支付宝账号
     */
    @ResponseBody
    @RequestMapping(value = "/bandingZfb", method = RequestMethod.POST)
    public Object bandingZfb(String username, String zfbNum, String id) {
        return accountService.bandingZfb(username, zfbNum, id);
    }

    /**
     * 查看绑定支付宝账号
     */
    @ResponseBody
    @RequestMapping(value = "/selectBandingZfb", method = RequestMethod.POST)
    public Object selectBandingZfb(String userid) {
        return accountService.selectBandingZfb(userid);
    }

    /**
     * 修改绑定支付宝账号
     */
    @ResponseBody
    @RequestMapping(value = "/updateBandingZfb", method = RequestMethod.POST)
    public Object updateBandingZfb(String userid, String username, String zfb_account) {
        return accountService.updateBandingZfb(userid, username, zfb_account);
    }

    /**
     * 查看银行卡号
     */
    @ResponseBody
    @RequestMapping(value = "/selectBindingBank", method = RequestMethod.POST)
    public Object selectBindingBank(String userid) {
        return accountService.selectBindingBank(userid);
    }

    /**
     * 修改绑定银行卡号
     */
    @ResponseBody
    @RequestMapping(value = "/updateBindingBank", method = RequestMethod.POST)
    public Object updateBindingBank(String username, String bankName, String bankNum, String userid) {
        return accountService.updateBindingBank(username, bankName, bankNum, userid);
    }


    @ResponseBody
    @RequestMapping(value = "deductMoney", method = RequestMethod.POST)
    public Object deductMoney(String userid) {
        return accountService.deductMoney(userid);

    }
}
